// function getData < T > (name: T): T {
//     return name
// }
// let aa = getData(123)
// console.log(aa)


function getData2 < T,U > (arr1:[T,U]): [U,T] {
    return [arr1[1],arr1[0]]
}
let aa2 = getData2(['123',123])
console.log(aa2)

function ArrwidthEcho<T>(arr: T[]):T[] {
    return arr
}
let foo = ArrwidthEcho([1, 2, '3'])

// 
interface echoWidthInterface {
    length:number
}

// 
function Echovalue<T extends echoWidthInterface> (arr: T): T{
    return arr
}

let one = Echovalue([1,3,3])
let two = Echovalue({name:123,length:123})
let three = Echovalue('123')

// 泛型与类的使用 
class quque<T> {
    private arr = []
    push(item:T) {
        this.arr.push(item)
    }
    pop() {
        this.arr.shift()
    }
}

let quque1 = new quque<number>()
quque1.push(123)
quque1.pop()

interface abc<T,U> {
    name:T
    value:U
}
let in1:abc<string,number> = {name:'fengzhilun', value:18}
let in2:Array<number> = [1, 2,3]